﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sStack
{
    class Stack
    {
        readonly List<object> values = new List<object>();

        public Object Pop ()
        {
            try
            {
                int idxOfLastValue = values.Count - 1;
                object value = values[idxOfLastValue];
                values.RemoveAt(idxOfLastValue);
                return value;
            }
            catch
            {
                Console.WriteLine("List is empty.");
                return null;
            }
        }

        public void Push (object value)
        {
            values.Add(value);
        }

        public void Clear()
        {
            values.Clear();
        }
        
    }
}
